﻿using UnityEngine;
using System.Collections;

public class UILoad : MonoBehaviour
{

		public bool replace;

		public string prefebName;

		// Use this for initialization
		void Awake ()
		{
				GameObject go = Instantiate (Resources.Load (prefebName)) as GameObject;
				Transform parent = transform;
				if (replace) {
						parent = parent.parent;
						GameObject.Destroy (gameObject);
				}

				if (parent != null) {
						VieworUtils.addViewAuto (go.transform, parent, true);
				}
		}
}
